# 函数优化
#  三元表达式
src = "abcevaefegsgdghfdefavbdr"
def count_items(src):
    src_set = set(src)
    src_dict = {}
    for i in src:
#         if i not in src_dict:
#             src_dict[i] = 1
#         else:
#             src_dict[i] += 1
          src_dict[i] = 1 if i not in src_dict else src_dict[i] + 1
    return src_dict
    
print(count_items(src))
# 这个也很好